/**
* Copyright (C)2001-2099 Zeai.cn All rights reserved.
* E-Mail：supdes#qq.com　QQ:7144100,797311
* http://www.zeai.cn
* http://www.yzlove.com
* Last update 2021/06/01 by supdes
*/
var url='reg_diy';


function regbtnFn(){
	var pwdV = o('pwd').value;
	var subscribeV = o('subscribe').value;
	if(reg_kind==2){
		var unameV = o('uname').value;
		if(zeai.str_len(unameV) < 3 || zeai.str_len(unameV)>20){zeai.msg('请输入3-15个字符登录用户名',o('uname'));return false;}
	}else if(reg_kind==1 || reg_kind==3){	
		var mobV = o('mob').value,verifyV=o('verify').value;
		if(!zeai.ifmob(mobV)){zeai.msg('请输入正确手机号',o('mob'));return false;}
		if(!zeai.ifint(verifyV)){zeai.msg('请输入手机验证码',o('verify'));return false;}
		if(reg_kind==3){
			var unameV = o('uname').value;
			if(zeai.str_len(unameV) < 3 || zeai.str_len(unameV)>20){zeai.msg('请输入3-15个字符登录用户名',o('uname'));return false;}
		}
	}
	if(zeai.str_len(pwdV)<6 || zeai.str_len(pwdV)>20){zeai.msg('请输入正确的登录密码(长度6~20)',o('pwd'));return false;}
	zeai.ajax({url:url+zeai.extname,form:WWW_ZEAI_CN_form},function (e){var rs=zeai.jsoneval(e);
		if (rs.flag==1){
			zeai.openurl(url+zeai.extname);
		}else if(rs.flag=='logined'){
			setTimeout(function(){zeai.openurl(HOST+'/m/my.php');},2000);
		}else{
			zeai.msg(0);zeai.msg(rs.msg);
		}
	});
}

function reg_diy_radio(t){
	zeai.listEach(zeai.tag(submain,'li'),function(li){
		li.onclick=function(){
			zeai.listEach(zeai.tag(submain,'li'),function(li){li.removeClass('ed')});
			this.addClass('ed');
			o(t).value=li.getAttribute("v");
		}
	});
}

function reg_diy_checkbox(t){
	var liobj=zeai.tag(submain,'li');
	zeai.listEach(liobj,function(li){
		li.onclick=function(){
			if(li.hasClass('ed')){
				li.removeClass('ed');
			}else{
				if(cnt(liobj)>=checkboxMaxNum){zeai.msg('亲，最多选择 '+checkboxMaxNum+' 项哦');return false;}
				li.addClass('ed');
			}
			reseted(liobj);
		}
	});
	function cnt(liobj){var n=0;zeai.listEach(liobj,function(li){if(li.hasClass('ed'))n++;});return n;}
	function reseted(liobj){
		var newarr=[];
		zeai.listEach(liobj,function(li){
			if(li.hasClass('ed'))newarr.push(li.getAttribute("v"));
		});
		o(t).value=newarr.join(",");
	}
}  
function rettop(){zeai.setScrollTop(0);}
function agreeDeclara(){zeai.mask({son:reg_private,cancelBubble:'off',click:'no',closeid:agree});}

if(t=='mate'){
	mate_age_ARR1 = age_ARR,
	mate_age_ARR2 = age_ARR,
	mate_heigh_ARR1 = heigh_ARR,
	mate_heigh_ARR2 = heigh_ARR,
	mate_weigh_ARR1 = weigh_ARR,
	mate_weigh_ARR2 = weigh_ARR,
	mate_pay_ARR = pay_ARR,
	mate_edu_ARR = edu_ARR,
	mate_love_ARR = love_ARR,
	mate_job_ARR = job_ARR,
	mate_house_ARR = house_ARR,
	mate_child_ARR = child_ARR,
	mate_marrytime_ARR = marrytime_ARR,
	mate_companykind_ARR = companykind_ARR,
	mate_smoking_ARR = smoking_ARR,
	mate_drink_ARR = drink_ARR,
	mate_car_ARR = car_ARR;
	var mate_areaARR1=areaARR1,mate_areaARR2=areaARR2,mate_areaARR3=areaARR3;
	var selstr2='不限';
	var bx = [{'i':'0','v':selstr2}];
	//var mate_love_ARR = bx.concat(love_ARR);
	//var mate_house_ARR = bx.concat(house_ARR);
	/*var mate_areaARR1,mate_areaARR2,mate_areaARR3;*/
	var defarea1=areaARR1[0].i;
	var defarea2=areaARRhj1[0].i;
	(function aeraPushBx(){
		var newA1 = [{'i':'ZE0000','v':selstr2,f:0}];
		var newA2 = [];
		var newA3 = [];
		mate_areaARR1=newA1.concat(areaARR1);
		function newA2fn(){
			for(var k=0;k<areaARR1.length;k++){newA2.push({'i':'AI'+k+'00','v':selstr2,f:mate_areaARR1[k].i});}
			return newA2;
		}
		function newA3fn(){
			for(var k=0;k<areaARR2.length;k++) {newA3.push({'i':'CN00'+k,'v':selstr2,f:mate_areaARR2[k].i});}
			return newA3;
		}
		mate_areaARR2=newA2fn().concat(areaARR2);
		mate_areaARR3=newA3fn().concat(areaARR3);
	})();
	var mate_areaARRhj1=areaARRhj1,mate_areaARRhj2=areaARRhj2,mate_areaARRhj3=areaARRhj3;
	(function aerahjPushBx(){
		var newA1 = [{'i':'ZE0000','v':selstr2,f:0}];
		var newA2 = [];
		var newA3 = [];
		mate_areaARRhj1=newA1.concat(areaARRhj1);
		function newA2fn(){
			for(var k=0;k<areaARRhj1.length;k++){newA2.push({'i':'AI'+k+'00','v':selstr2,f:mate_areaARRhj1[k].i});}
			return newA2;
		}
		function newA3fn(){
			for(var k=0;k<areaARRhj2.length;k++) {newA3.push({'i':'CN00'+k,'v':selstr2,f:mate_areaARRhj2[k].i});}
			return newA3;
		}
		mate_areaARRhj2=newA2fn().concat(areaARRhj2);
		mate_areaARRhj3=newA3fn().concat(areaARRhj3);
	})();
}

function ajax_click_yzmFn(){
	zeai.ajax({url:'reg_diy'+zeai.ajxext+'submitok=ajax_click_yzm'},function(e){var rs=zeai.jsoneval(e);
		zeai_yzm_em.style.backgroundColor=rs.bg;
		zeai_yzm_li.html(rs.li);
		zeai.mask({son:zeai_yzm,maskcls:'mask_TRnav'});
		zeai.listEach(zeai.tag(zeai_yzm_li,'li'),function(obj){
			obj.onclick=function(){zeai_yzm_liFn(rs.bg,this.innerHTML);};
		});

	});
}
function zeai_yzm_liFn(bg,v){
	zeai.ajax({url:'reg_diy'+zeai.ajxext+'submitok=ajax_click_yzm_chk',data:{bg:bg,v:v}},function(e){rs=zeai.jsoneval(e);
		zeai.msg(0);zeai.msg(rs.msg);
		if(rs.flag==1){
			zeai_yzm.hide();
			setTimeout(function(){
				if (!yzmbtn.hasClass('disabled')){
					yzmbtn.addClass('disabled');
					zeai.ajax({url:'reg_diy'+zeai.extname,data:{'submitok':'ajax_reg_verify',mob:o('mob').value,bg:bg,v:v}},function(e){
						var rs=zeai.jsoneval(e);
						zeai.msg(0);
						if (rs.flag == 1){
							zeai.msg(rs.msg,{time:4});o('verify').value='';yzmtimeFn2(120);
						}else{
							zeai.msg(rs.msg);yzmbtn.removeClass('disabled');
						}
						Mzeai_yzm.click();
					});
				}
			},200);			
		}else{
			zeai.msg(rs.msg);
			setTimeout(function(){ajax_click_yzmFn();},1000);
		}
	});
}
function yzmtimeFn2(countdown){
	var yzmbtn=o('yzmbtn');
	if (countdown == 0) {
		yzmbtn.removeClass('disabled');yzmbtn.html('<font>重新获取</font>');return false;
	} else { 
		yzmbtn.addClass('disabled');yzmbtn.html('<b>'+countdown + "S</b>后重新发送");countdown--; 
	} 
	cleandsj=setTimeout(function(){yzmtimeFn2(countdown)},1000);
}
